<?php
$this->breadcrumbs=array(
	'客户信息'=>array('admin'),
	'列表',
);

$this->menu=array(
	array('label'=>'客户列表', 'url'=>array('index')),
	array('label'=>'创建新客户', 'url'=>array('create')),
);

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$.fn.yiiGridView.update('customers-grid', {
		data: $(this).serialize()
	});
	return false;
});
");
?>

<div class="remarks">管理所有客户信息：客户是指单位帐户，与之相对应的是客户单位的联系人，是实施合作项目的具体人员。</div>
<br />

<?php echo CHtml::link('高级搜索','#',array('class'=>'search-button')); ?>
<div class="search-form" style="display:none">
<?php $this->renderPartial('_search',array(
	'model'=>$model,
)); ?>
</div><!-- search-form -->

<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'customers-grid',
	'dataProvider'=>$model->search(),
	'columns'=>array(
		//'customer_id',
         array(
		'name'=>'customer_id', 
        'htmlOptions'=>array( 
                        'width'=>'80', 
                        'style'=>'text-align:center', 
        )),
		array(
		'class'=>'CLinkColumn',
		'header'=>$model->getAttributeLabel("customer_unit"),
		'labelExpression'=>'"$data->customer_unit"',
		'urlExpression'=>'Yii::app()->createUrl("admin/customers/view", array("customer_id" => $data->customer_id))',
		),
		array(
		'name'=>'customer_source', 
        'htmlOptions'=>array( 
                        'width'=>'80', 
                        //'style'=>'text-align:center', 
        )),
		//'customer_source',
		array(
		name=>'customer_status',
		value=>'$data->getCustomerStatusText()',
		'htmlOptions'=>array( 
                        'width'=>'80', 
                        //'style'=>'text-align:center', 
        )
		),
		array(
			  //'name'=>'Op',
		      'class'=>'CButtonColumn',
		      'viewButtonUrl'=>'Yii::app()->createUrl("admin/customers/view", array("customer_id" => $data->customer_id))',
		      'deleteButtonUrl'=>'Yii::app()->createUrl("admin/customers/delete", array("customer_id" => $data->customer_id))',
		      'updateButtonUrl'=>'Yii::app()->createUrl("admin/customers/update", array("customer_id" => $data->customer_id))',
		      'htmlOptions'=>array( 
                        'width'=>'100', 
                        //'style'=>'text-align:center', 
        )
		),
				
	),
)); ?>
